<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * 用户基本模型
 *
 * Created by PhpStorm.
 * User: li
 * Date: 15-10-29
 * Time: 上午10:33
 */
class Users_model extends MY_Model
{
    function __construct(){
        parent::__construct();
        $this->_table_name = 'users';
    }

    function get_user_by_id($user_id){
        $this->db->select('username,nickname,mobile,email,gender,avatar,tags,introduce,is_certify');
        $this->db->where('id',$user_id);
        $this->db->where('is_del',0);
        $query = $this->db->get($this->_table_name);
        if($query->num_rows()==1){
            return $query->row_array();
        }
        return null;
    }

    function get_user_by_mobile($mobile){
        $this->db->select('username,nickname,mobile,email,gender,avatar,tags,introduce,is_certify');
        $this->db->where('mobile',$mobile);
        $this->db->where('is_del',0);
        $query = $this->db->get($this->_table_name);
        if($query->num_rows()==1){
            return $query->row_array();
        }
        return null;
    }
}